# coding=utf-8
import pandas as pd
import numpy as np
import matplotlib.pyplot as mplt # pip install matplotlib

data =pd.read_excel('students.xls')
# data=r_file.parse('Sheet1')
print('---------',data)
# 求各省的个数
pt_n=pd.pivot_table(data,index=['省份'],aggfunc=np.size) #aggfunc=np.sum求和，默认是平均值

mplt.rcParams['font.sans-serif']=['SimHei']
pt_n.plot(kind='bar')

# 修改
#  index的倾斜角度
mplt.xticks(rotation=45)
mplt.title('各省数量')
mplt.xlabel('省份')
mplt.ylabel('个数')
mplt.legend()

mplt.show()

